package pl.lwozniak.blip;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Properties;

import pl.lwozniak.blip.entities.Status;

/**
 * Utility for testing single calls w/o running whole test suit.
 * 
 * @author Lukasz Wozniak
 * 
 */
public class Util {

	/**
	 * @param args
	 * @throws IOException
	 * @throws BlipConnectorException
	 * @throws Exception
	 */
	public static void main(String[] args) throws Exception {
		Properties props = new Properties();
		InputStream is = Util.class.getClassLoader().getResourceAsStream(
				"test.properties");
		props.load(is);
		String username = props.getProperty("username");
		String password = props.getProperty("password");
		BlipConnector bc = new BlipConnector(username, password, null, null,
				"Test client 0.0.1");
		// bc.createDirectedMessage("Testing", "blip");
		// File f = new File("bloody_kiss.jpg");
		// bc.createStatus("api test", new FileInputStream(f), f.getName(),
		// null,
		// f.length());
		// System.out.println(bc.getUpdates(0, 0));

		// System.out.println(">>>>>>>>> Notices");
		// List<? extends Status> res = bc.getNotices(10,15, 0,0);
		// for (Status status : res) {
		// System.out.println(status);
		// }
		
		try{
			Status stat = bc.createStatus("Bardzo dlugi status." +
				"Bardzo dlugi status." +
				"Bardzo dlugi status." +
				"Bardzo dlugi status." +
				"Bardzo dlugi status." +
				"Bardzo dlugi status." +
				"Bardzo dlugi status." +
				"Bardzo dlugi status." +
				"Bardzo dlugi status." +
				"Bardzo dlugi status." +
				"Bardzo dlugi status." +
				"Bardzo dlugi status." +
				"Bardzo dlugi status." +
				"Bardzo dlugi status. ");
			System.out.println(stat);
		} catch (BlipConnectorException e) {
			System.out.println(e.getError());
		}

		// System.out.println(">>>>>>>>> Dashboard");
		// List<? extends Status> res = bc.getDashboard(10, 10, 0,
		// BlipConnector.INCLUDE_USER | BlipConnector.INCLUDE_USER_AVATAR);
		// for (Status status : res) {
		// System.out.println(status);
		// }
	}
}
